package org.aiforum.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/*
 * 用户实体类
 */
@Entity// 标识ai_user类是一个pojo类
@NamedQueries({@NamedQuery(name="queryByAccounts",query="from User u where u.account = :account")})
@Table(name="ai_user")
public class User {
	@Id // 标识userid为主键
	@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="user_sequence") //标识主键生成值
	@SequenceGenerator(sequenceName="seq_user",name="user_sequence",initialValue=11,allocationSize=1)
	private int userid;
	//设置数据库表和javabean对应关系
	@Column(name="account")
    private String account;
	@Column(name="password")
    private String password;
	@Column(name="email")
    private String email;
	@Column(name="state")
    private int state;
	public String getAccount() {
		return account;
	}
	public void setAccount(String account) {
		this.account = account;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
	public int getUserid() {
		return userid;
	}
	public void setUserid(int userid) {
		this.userid = userid;
	}
	public int getState() {
		return state;
	}
	public void setState(int state) {
		this.state = state;
	}
	@Override
	public String toString() {
		return "User [userid=" + userid + ", account=" + account + ", email=" + email + ", password=" + password
				+ ", state=" + state + "]";
	}
	
}
